import 'package:flutter/material.dart';

class SearchPage extends StatefulWidget {
  final String title;
  const SearchPage({super.key, this.title = "search"});

  @override
  State<SearchPage> createState() => _SearchPageState();
}

class _SearchPageState extends State<SearchPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          // 访问路由传递的参数
          title: Text(widget.title),
          centerTitle: true,
        ),
        body: ListView(
          children: [
            Text('searchPage'),
            Row(
              children: [
                IconButton(
                    style: ButtonStyle(
                        backgroundColor:
                            WidgetStateProperty.all(Colors.red), //背景颜色
                        foregroundColor:
                            WidgetStateProperty.all(Colors.white) //文字图标颜色
                        ),
                    onPressed: () {
                      Navigator.pop(context); // 返回上一页
                    },
                    icon: Icon(Icons.chevron_left_sharp))
              ],
            )
          ],
        ));
  }
}
